package scala.day03

import com.google.gson.Gson

import scala.io.Source

object Demo33Json {
  def main(args: Array[String]): Unit = {
    val list: List[String] = Source.fromFile("data/students.json").getLines().toList
    //创建一个gson对象
    val gson = new Gson()
    list.map(f => {
      val student: Student = gson.fromJson(f,classOf[Student])
      println(student)
    })
  }
  //创建一个样例类，接收Gson处理的数据
  case class Student(id: String, name: String, age: Int, gender: String, clazz: String)
}
